package com.pocket.demo.business.controller.vo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.pocket.demo.core.validation.Mobile;
import com.pocket.demo.core.validation.ValidationEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

/**
 * @author zhaozhile
 */
@Schema(description = "管理后台 - 用户创建/修改 Request VO")
@Data
@ValidationEntity("user")
public class UserSaveReqVO {

    @TableId
    @Schema(name = "userId", title = "ID")
    private String userId;

    @Schema(name = "nickName", title = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "Cookie")
    @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$")
    private String nickName;

    @Schema(name = "realName", title = "真实姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "小饼干")
    @Size(min = 2, max = 30)
    private String realName;

    @Schema(name = "userMail", title = "用户邮箱", example = "cookie@pocket.cn")
    @Email(message = "邮箱格式不正确")
    @Size(max = 50, message = "邮箱长度不能超过 50 个字符")
    private String userMail;

    @Schema(name = "loginPassword", title = "登录密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
    @Length(min = 4, max = 16, message = "密码长度为 4-16 位")
    private String loginPassword;

    @Schema(name = "payPassword", title = "支付密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
    @Length(min = 4, max = 16, message = "密码长度为 4-16 位")
    private String payPassword;

    @Schema(name = "userMobile", title = "手机号码", example = "15601691300")
    @Mobile
    private String userMobile;

    @Schema(name = "userMemo", title = "备注", example ="")
    private String userMemo;

    @Schema(name = "sex", title = "性别：M(男) or F(女)", requiredMode = Schema.RequiredMode.REQUIRED, example = "M")
    private String sex;

    @Schema(name = "birthDate", title = "生日", example = "2009-11-27")
    private String birthDate;

    @Schema(name = "pic", title = "头像图片路径", example = "https://www.iocoder.cn/xxx.png")
    private String pic;

}
